<template>
	<view class="content">
		<view class="block remark-block" v-if="info.enrollModelInfo.status==2">
			<view class="title">未通过：</view>
			<view class="remark">{{info.enrollModelInfo.remark}}</view>
		</view>
		<view class="block info-block">
			<view class="title-item">
				<view class="title">{{info.courseName}}</view>
				<view class="wage">{{info.price}}<text class="txt">元</text></view>
			</view>
			<view class="time">开班时间：{{info.startTime}}至{{info.endTime}}</view>
			<view class="time">培训天数：{{info.dayText}}天</view>
			<!-- <view class="train-item">培训工种：<view class="train-list" v-for="item in info.sonList" :key="item.id">
					<view class="train">{{item.name}}</view>
				</view>
			</view> -->
			<view class="train-item">培训工种：<view class="train-list">
					<view class="train">{{info.configIdText}}</view>
				</view>
			</view>
		</view>
		<view class="block introduce-block">
			<view class="title">课程简介</view>
			<mp-html :content="info.introduce" />
		</view>
		<!-- <view class="title">推荐职位</view>
		<view class="block job-block" v-for="item in list" :key="item.id">
			<view class="title-item">
				<view class="name">{{item.title}}</view>
				<view class="worry" v-if="item.worry==1">急招</view>
			</view>
			<view class="wage">{{item.minSalary}}-{{item.maxSalary}}<text class="txt">元/月</text></view>
			<view class="distances-item">
				<view class="address-item">
					<view class="iconfont icon-dingwei"></view>
					<view class="address">{{item.address}}</view>
				</view>
				<view class="distance">距离：{{item.distances}}km</view>
			</view>
		</view> -->
		<view class="btn" @click="navigate('/page_other/train/apply?id='+id)" v-if="type==0">立即报名</view>
	</view>
</template>

<script>
	import {
		getSpecialityById,
		getInformation
	} from '@/api/train.js'
	export default {
		data() {
			return {
				id: null,
				info: {
					courseName: '',
					startTime: '',
					endTime: '',
					dayText: 5,
					price: null,
					configIdText: '',
					introduce: ''

				},
				list: [],
				type: 0
			}
		},
		methods: {
			navigate(url) {
				uni.navigateTo({
					url
				})
			},
			getDetail() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getSpecialityById({
					id: this.id
				}).then((res) => {
					uni.hideLoading()
					this.info = res;
				})
			},
			getInformation() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getInformation({
					id: this.id
				}).then((res) => {
					uni.hideLoading()
					this.info = res;
				})
			},
		},
		onLoad(e) {
			this.id = e.id
			if (e.type) {
				this.type = e.type
				this.getInformation()
			} else {
				this.getDetail()
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background: #FAFAFA;
	}

	.content {
		padding: 30rpx;

		.block {
			width: 100%;
			border-radius: 20rpx;
			background: #fff;
			padding: 20rpx;
			margin-bottom: 30rpx;
		}

		.info-block {
			display: flex;
			flex-direction: column;

			.title-item {
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-bottom: 1px solid #efefef;
				padding-bottom: 30rpx;

				.title {
					font-size: 38rpx;
					font-weight: bold;
				}

				.wage {
					color: #0256FF;
					font-size: 38rpx;

					.txt {
						color: #0256FF;
						font-size: 26rpx;
						margin-left: 6rpx;
					}
				}
			}

			.time {
				display: flex;
				align-items: center;
				margin-top: 30rpx;
			}

			.train-item {
				display: flex;
				margin-top: 30rpx;
				flex-wrap: wrap;

				.train-list {
					display: flex;
					align-items: center;
					justify-content: center;
					background-color: #E4EFFF;
					color: #0256FF;
					border-radius: 12rpx;
					margin-right: 20rpx;
					margin-bottom: 20rpx;


					.train {
						padding: 8rpx 20rpx;
						font-size: 28rpx;
					}
				}
			}
		}

		.introduce-block {
			display: flex;
			flex-direction: column;

			.title {
				font-size: 34rpx;
				font-weight: bold;
				margin-bottom: 30rpx;
			}
		}

		.remark-block {
			display: flex;
			flex-direction: row;
			padding: 30rpx;

			.title {
				font-size: 34rpx;
				color: red;
			}

			.remark {
				color: red;
			}
		}

		.title {
			font-size: 34rpx;
			font-weight: bold;
			margin-bottom: 30rpx;
		}

		.job-block {
			display: flex;
			flex-direction: column;

			.title-item {
				display: flex;

				.name {
					max-width: calc(100% - 120rpx);
					font-size: 32rpx;
					margin-right: 30rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				.worry {
					display: flex;
					align-items: center;
					justify-content: center;
					background-color: #E4EFFF;
					color: #0256FF;
					border-radius: 12rpx;
					width: 80rpx;
					height: 40rpx;
					font-size: 28rpx;
				}
			}

			.wage {
				display: flex;
				align-items: flex-end;
				color: #0256FF;
				font-size: 34rpx;
				margin-top: 30rpx;

				.txt {
					color: #0256FF;
					font-size: 24rpx;
					margin-left: 6rpx;
				}
			}

			.distances-item {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 30rpx;

				.address-item {
					display: flex;
					align-items: center;
					color: #767676;
					max-width: calc(100% - 250rpx);
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;

					.iconfont {
						font-size: 28rpx;
						margin-right: 6rpx;
					}

					.address {
						font-size: 28rpx;
					}
				}

				.distance {
					color: #767676;
					font-size: 28rpx;
					max-width: 240rpx;
				}
			}
		}

		.btn {
			width: 350rpx;
			height: 80rpx;
			line-height: 80rpx;
			color: #fff;
			text-align: center;
			margin: 100rpx auto 30rpx auto;
			background-color: #0256FF;
			border-radius: 80rpx;
			position: sticky;
			bottom: 60rpx;
		}
	}
</style>